package com.haiheng.voiceandbook.adapter

import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.haiheng.bookmusic.common.CategoryBean
import com.haiheng.voiceandbook.R


class AllTypeVoiceAdapter(layoutResId: Int, data: List<CategoryBean>?) :
    BaseQuickAdapter<CategoryBean, BaseViewHolder>(layoutResId, data) {
    private val TAG = "AllTypeAdapter"

    override fun convert(helper: BaseViewHolder?, item: CategoryBean?) {
        helper?.run {
            if(item?.isSelect!!){
                helper.getView<ImageView>(R.id.iv_left).visibility = View.VISIBLE
                helper.getView<TextView>(R.id.name).setTextColor(mContext.resources.getColor(R.color.black))
            }
            else{
                helper.getView<ImageView>(R.id.iv_left).visibility = View.INVISIBLE
                helper.getView<TextView>(R.id.name).setTextColor(mContext.resources.getColor(R.color.dark))
            }
            setText(R.id.name, item?.category?.categoryName)

        }


    }


}